<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 * @version		$Id: Config.php 108 2011-04-11 17:33:46Z ninhgio@gmail.com $
 */

class Modules_Mail_Controllers_Config extends Gio_Core_Controller
{
	/* ========== Backend actions =========================================== */
	
	/**
	 * Configure mail server
	 * 
	 * @return void
	 */
	public function serverAction()
	{
		$config  = Modules_Mail_Services_Mail::getConfig();
		$request = $this->getRequest();
		
		if ($request->isPost()) {
			$data = $request->getPost('config');
			
			Modules_Mail_Services_Mail::saveConfig($data);
			Gio_Core_Messenger::getInstance()
								->addMessage($this->view->TRANSLATOR->translator('config_actions_server_success'));
			$this->redirect($this->view->url('mail_config_server'));
		}
		
		$this->view->configData = $config;
	}
}
